package com.tbocek.android.ode.solver;

import java.util.List;

/**
 * Generic interface for an ODE solver.
 * @author Tim
 *
 */
public abstract class Solver {
	
	/**
	 * Timestep to use.  This may just be an initial guess if the solver is
	 * adaptive.
	 */
	protected float deltaT = 1.0f;
	
	/**
	 * @return The time step.
	 */
	public float getTimeStep() {
		return deltaT;
	}
	
	/**
	 * Sets the time step.  This may be used as an initial guess only, if the
	 * solver is an adaptive method.
	 * @param timeStep The new time step to use.
	 */
	public void setTimeStep(float timeStep) {
		deltaT = timeStep;
	}
	
	/**
	 * Solves the system up to and including finalTime.
	 * @param system The system of equations to solve.
	 * @param initialState The initial state of the system.
	 * @param finalTime The time to end the solution at.
	 * @return A list of SystemStates starting with the initial condition and
	 * 		time stepped forward until finalTime.
	 */
	public abstract List<SystemState> solve(
			ODESystem system, SystemState initialState, float finalTime);
}
